package com.xebest.web.service.impl;

import com.xebest.web.mapper.read.XeVenOrderReadMapper;
import com.xebest.web.mapper.write.XeVenOrderWriteMapper;
import com.xebest.web.mapper.write.XeVenSummaryPurchWriteMapper;
import com.xebest.web.model.XeVenSummaryPurchEntity;
import com.xebest.web.service.XeVenSummaryPurchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author: ruancz
 * Created by xebest on 2017/8/4.
 */
@Service
public class XeVenSummaryPurchServiceImpl implements XeVenSummaryPurchService{

    @Autowired
    private XeVenSummaryPurchWriteMapper xeVenSummaryPurchWriteMapper;
    @Autowired
    private XeVenOrderReadMapper xeVenOrderReadMapper;
    @Autowired
    private XeVenOrderWriteMapper xeVenOrderWriteMapper;

    /**
     *  插入订单采购表
     * @author: ruancz
     * @param xeVenSummaryPurchEntity
     * @return
     */
    @Override
    public int insertXeVenSummaryPurch(XeVenSummaryPurchEntity xeVenSummaryPurchEntity) {
        return xeVenSummaryPurchWriteMapper.insertXeVenSummaryPurch(xeVenSummaryPurchEntity);
    }

    /**
     * @author: ruancz
     * 更新订单采购表
     * @param params
     * @return
     */
    @Override
    public int updateXeVenSummaryPurch(Map<String, Object> params) {
        return xeVenSummaryPurchWriteMapper.updateXeVenSummaryPurch(params);
    }

    /**
     * @author: ruancz
     * 查询订单采购表
     * @param orderId
     * @return
     */
    @Override
    public List<Map<String, Object>> queryOrderListByParams(Map<String, Object> params) {
        return xeVenOrderWriteMapper.queryOrderListByParams(params);
    }
    /**
     * @author: ruancz
     *  批量插入采购订单关联表
     * @param summaryPurchList
     */
    @Override
    public int insertBatchXeVenSummaryPurch(List<XeVenSummaryPurchEntity> summaryPurchList) {
        return xeVenSummaryPurchWriteMapper.insertBatchXeVenSummaryPurch(summaryPurchList);
    }

    @Override
    public int queryExistsSumPurchByParams(Map<String, Object> params) {
        return xeVenSummaryPurchWriteMapper.queryExistsSumPurchByParams(params);
    }
}
